import string
import StringIO

s = StringIO.StringIO()
s.write("aaaa")
lines = ['xxxxx\n', 'bbbbbbb\n']
s.writelines(lines)

s.seek(0)
print s.read()

print s.getvalue()
s.write(" ttttttttt ")
s.seek(0)
print s.readlines()
print s.len
